home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
aminet
/
dev
/
lang
/
perl4_035_v010.lzh
/
perl4.035
/
cscript
/
cprogram.h
next >
Wrap
Text File
|
1992-08-31
|
1KB
|
39 lines
char *gacCProgram[] = {
" char acTmp[BUFSIZ];\n",
" char *pcArgs=NULL;\n",
" char *pcTmp = NULL;\n",
" FILE *pFScript;\n",
"\n",
" for(i=1; i<argc; i++) {\n",
" if(pcArgs == NULL) {\n",
" if((pcArgs = (char *)malloc(strlen(argv[i])+1)) == NULL) {\n",
" fprintf(stderr, \"%%s: *** Error - malloc failed\\n\", PROGRAM);\n",
" exit(1);\n",
" }\n",
" strcpy(pcArgs, argv[i]);\n",
" }\n",
" else {\n",
" if((pcTmp = (char *)malloc(strlen(argv[i])+strlen(pcArgs)+2)) == NULL) {\n",
" fprintf(stderr, \"%%s: *** Error - malloc failed\\n\", PROGRAM);\n",
" exit(1);\n",
" }\n",
" sprintf(pcTmp,\"%%s %%s\", pcArgs, argv[i]);\n",
" free(pcArgs);\n",
" pcArgs = pcTmp;\n",
" }\n",
" }\n",
"\n",
" /*** Open temporary script file ***/\n",
" if((pFScript = fopen(SCRIPT, \"w\")) == NULL) { \n",
" fprintf(stderr, \"%%s: *** Error - can't open script file: %%s\\n\", PROGRAM, SCRIPT);\n",
" exit(1);\n",
" }\n",
" \n",
" for(i=0; gacScript[i] != NULL; i++) {\n",
" fprintf(pFScript, gacScript[i]);\n",
" }\n",
" fclose(pFScript);\n",
"\n",
NULL
};